package com.Day7;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Copyright (C), 2018-2021, 若若叶
 * Author: Hx162
 * Date: 2021/7/14 15:39
 * FileName: MyDate
 * Description: 日期
 */
public class MyDate {

    public static void main(String[] args) {
        Date date = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS");
        String format = simpleDateFormat.format(date);
        System.out.println(format);

        //获取自1970-1-1 00：00：00 000到现在的毫秒数
        long begin = System.currentTimeMillis();
        print();
        long end = System.currentTimeMillis();
        //相减可以获取程序运行时间
        System.out.println(end-begin);
    }

    public static void print(){
        for (int i = 0; i < 1000; i++) {
            System.out.println("i-->" + i);
        }
    }
}
